﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TSEntry.aspx.cs" Inherits="Tesla.Web.Pages.TSEntry" MasterPageFile="~/Pages/Tesla.Master" %>


<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="server">
    <title></title>
    
    <script type="text/javascript">
        function sumField(txt) {
            //number field
            if (Number(txt.value) > 24) {
                txt.value = '';
                return false;
            }
            var taskPart = txt.id.substring(txt.id.lastIndexOf('_') + 1);
            var parentPhaseId = taskPart.split('~')[0] + '~Phase~' + taskPart.split('~')[1];
            var phaseSelector = "[name$='" + parentPhaseId + "']";

            if ($(phaseSelector).size() > 0) {
                $number1 = $(phaseSelector).val() == '' ? 0 : $(phaseSelector).val();
                $number2 = txt.value;
                $(phaseSelector).val(Number($number1) + Number($number2));
            }
        }

        $(document).ready(function () {
            $('[type=text]').keypress(function (evt) {
                var charCode = (evt.which) ? evt.which : event.keyCode
                if (charCode > 31 && (charCode < 48 || charCode > 57))
                    return false;
            });

        });
    </script>

    <style type="text/css">
    input[type=text][readonly]
{
    background-color: #CBCFCB;
    border-style: solid;
    border-color: #CBCFCB;
    border-width: 1px;
}
input[type=text][readonly]:hover
{
    background-color: #CBCFCB;
    border-style: solid;
    border-color: #CBCFCF;
    border-width: 1px;
    cursor: default;
}
input[type=text]
{
    font-family: Arial;
    font-size: 8.5pt;
    font-weight: normal;
    border-style: Solid;
    border-width: 1px;
    border-color: #CAE2F9;
    width: 30px;
    text-align:center;
}

input[type=text]:hover
{
    border-style: Solid;
    border-width: 1px;
    border-color: Navy;
}
input:focus
{
   background-color: Aqua;
}
th
{
	font-family:Trebuchet MS;
	font-size:8pt;
	background-color:Blue;
	color:White;
	width:50px;
	white-space:pre-wrap;
}
td
{
	font-family:Trebuchet MS;
	font-size:8pt;
	padding-left:8px;
	padding-right:2px;
	padding-bottom:2px;
	padding-top:2px;
}
.project-col
{
	width:100px;
}
.phase-col
{
	width:100px;
}
.project-row
{
	font-weight:bold;
	font-size:9pt;
}
.phase-row
{
	font-weight:bold;
	font-size:9pt;
}
.phase-row input[type=text]
{
	font-weight:bold;
	font-size:9pt;
}

.task-col
{
	width:150px;
}
</style>


  
     <div>
        <asp:Button runat="server" ID="btnSave" Text="Save" OnClick="btnSave_Click" />
    </div>
    <div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
            <Columns>
                <asp:TemplateField HeaderText="Project ID" Visible="false">
                    <ItemTemplate>
                        <asp:Label ID="lblProjectId" runat="server" Text='<%# Eval("ProjectID") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Project Name" HeaderStyle-CssClass="project-col">
                    <ItemTemplate>
                        <asp:Label ID="lblProjectName" runat="server" Text='<%# Eval("ProjectID") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Phase ID" Visible="false">
                    <ItemTemplate>
                        <asp:Label ID="lblPhaseId" runat="server" Text='<%# Eval("PhaseID") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Phase Name" HeaderStyle-CssClass="phase-col">
                    <ItemTemplate>
                        <asp:Label ID="lblPhaseName" runat="server" Text='<%# Eval("PhaseID") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Task ID" Visible="false">
                    <ItemTemplate>
                        <asp:Label ID="lblTaskId" runat="server" Text='<%# Eval("TaskId") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Task Name" HeaderStyle-CssClass="task-col">
                    <ItemTemplate>
                        <asp:Label ID="lblTaskName" runat="server" Text='<%# Eval("ItemDisplayName") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:TextBox ID="txtDay1" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:TextBox ID="txtDay2" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:TextBox ID="txtDay3" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:TextBox ID="txtDay4" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:TextBox ID="txtDay5" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:TextBox ID="txtDay6" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:TextBox ID="txtDay7" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
   

    </asp:Content>
